﻿@model GameSchool.ViewModels.Account.ListViewModel
@{
    ViewBag.Title = "Notendalisti";
}
<h2>
    Notendalisti</h2>
<p>
    <a href="@Url.Action("Create")" class="btn">Skrá nýjan notanda</a>
</p>
@if (!string.IsNullOrEmpty(Model.userJustUpdated))
{
    <p>
        <span class="label label-info">Notandinn "@Server.HtmlEncode(Model.userJustUpdated)"
            var uppfærður</span>
    </p>
}
else if (!string.IsNullOrEmpty(Model.userJustCreated))
{
    <p>
        <span class="label label-info">Notandinn "@Server.HtmlEncode(Model.userJustCreated)"
            var búinn til</span>
    </p>
}
else if (!string.IsNullOrEmpty(Model.userJustChangedPassword))
{
    <p>
        <span class="label label-info">Lykilorðið hefur verið uppfært fyrir notandann "@Server.HtmlEncode(Model.userJustChangedPassword)"</span>
    </p>
}
<table class="table table-striped">
    <tr>
        <th>
            Nafn
        </th>
        <th>
            Tegund
        </th>
        <th>
            Notandanafn
        </th>
        <th>
            Email
        </th>
        <th>
        </th>
    </tr>
    @foreach (var item in Model.userListModel)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.FullName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.UserType)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.UserName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Email)
            </td>
            <td>
                @Html.ActionLink("Breyta", "Edit", new { userId = item.UserId }, new { @class = "btn btn-mini" })
                @Html.ActionLink("Breyta lykilorði", "ChangePassword", new { userId = item.UserId }, new { @class = "btn btn-mini" })
            </td>
        </tr>
    }
</table>
